package com.example.userbeandemo;

import com.domain.Userinfo;
import com.mapper.UserinfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import java.util.List;

@RestController
public class UserController {

    @Autowired
    private UserinfoMapper up;
    @RequestMapping("/user/{id}")
    public String user(@PathVariable Integer id){
        Userinfo userinfo = up.selectByPrimaryKey(id);

        String json= JSON.toJSONString(userinfo);
        return json;
    }
}
